Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

jest-message-util

Package Overview
Dependencies
35
Maintainers
6
Versions
202
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-message-util


Version published
Maintainers
6
Created

Package description

What is jest-message-util?

The jest-message-util package provides utilities for formatting and handling error messages in Jest, a popular JavaScript testing framework. It is particularly useful for creating custom error messages and enhancing the readability of test results.

What are jest-message-util's main functionalities?

formatStackTrace

The formatStackTrace function formats a stack trace to make it more readable. This is particularly useful for debugging and understanding where errors occur in your tests.

const { formatStackTrace } = require('jest-message-util');
const stack = new Error().stack;
const formattedStack = formatStackTrace(stack, { rootDir: process.cwd(), testMatch: [] });
console.log(formattedStack);

formatExecError

The formatExecError function formats execution errors to provide more context and readability. This helps in quickly identifying the cause of test failures.

const { formatExecError } = require('jest-message-util');
const error = new Error('Test error');
const formattedError = formatExecError(error, { rootDir: process.cwd(), testMatch: [] });
console.log(formattedError);

getTopFrame

The getTopFrame function extracts the top frame from a stack trace. This is useful for pinpointing the exact location of an error in your code.

const { getTopFrame } = require('jest-message-util');
const stack = new Error().stack;
const topFrame = getTopFrame(stack);
console.log(topFrame);

Other packages similar to jest-message-util

Changelog

Source

28.1.3

Features

  • [jest-leak-detector] Use native FinalizationRegistry when it exists to get rid of external C dependency (#12973)

Fixes

  • [jest-changed-files] Fix a lock-up after repeated invocations (#12757)
  • [@jest/expect-utils] Fix deep equality of ImmutableJS OrderedSets (#12977)
  • [jest-mock] Add index signature support for spyOn types (#13013, #13020)
  • [jest-snapshot] Fix indentation of awaited inline snapshots (#12986)

Chore & Maintenance

  • [*] Replace internal usage of pretty-format/ConvertAnsi with jest-serializer-ansi-escapes (#12935, #13004)
  • [docs] Update spyOn docs (#13000)

FAQs

Last updated on 13 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc